package com.lu.sb210222server;

import com.lu.sb210222server.server.NettyServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.net.InetSocketAddress;

@SpringBootApplication
public class Sb210222ServerApplication implements CommandLineRunner {

    public static void main(String[] args) {
        SpringApplication.run(Sb210222ServerApplication.class, args);
    }

    // netty server 相关
    @Autowired
    private NettyServer nettyServer;

    @Value("${socket.port}")
    private Integer socketPort;

    @Value("${socket.ip}")
    private String socketIp;

    @Override
    public void run(String... args) {

        InetSocketAddress inetSocketAddress = new InetSocketAddress(socketIp, socketPort);

        nettyServer.run(inetSocketAddress);

    }

}
